export async function request(url, data = {}, method = 'POST', header = {}) {
    try {
        // const baseurl = 'https://cz.jiuheyun.top/api';
        const baseurl = 'https://czadmin.jiuheyun.top/api';

        data.salt = localStorage.getItem('salt') != 'undefined' ? localStorage.getItem('salt') : '';
        data.app = localStorage.getItem('app') != 'undefined' ? localStorage.getItem('app') : '';
        data.token = localStorage.getItem('token') != 'undefined' ? localStorage.getItem('token') : '';

        const response = await uni.request({
            url: `${baseurl}${url}`,
            method,
            data,
            header,
        });

        if (response.statusCode === 200) {
            return response.data;
        } else {
            console.log('网络异常');
        }
    } catch (error) {
        console.log('错误', error);
    }
}